import {legacy_createStore, combineReducers, applyMiddleware,compose} from "redux";
import handleNum from './numState/reducer'
import handleArr from './arrState/reducer'
import handleUser from './userState/reducer'
import reduxThunk from 'redux-thunk'

// 组合各个模块的reducer
const reducers = combineReducers({
    handleNum,
    handleArr,
    handleUser
})

// 创建数据仓库
// window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(): 用来在控制台显示redux的功能
// const store = legacy_createStore(reducers, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());


const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):compose

// 把仓库数据，浏览器redux-dev-tools，还有reduxThunk插件关联在store中
const store = legacy_createStore(reducers,composeEnhancers(applyMiddleware(reduxThunk))); //rt
export default store